package com.jlboot.app.admin.router;

import cn.dev33.satoken.jfinal.SaAnnotationInterceptor;
import com.jlboot.app.admin.controller.IndexController;
import com.jlboot.app.admin.controller.LoginController;
import com.jlboot.app.admin.controller.sys.*;
import com.jlboot.app.admin.controller.test.controller.*;
import com.jlboot.app.admin.controller.weixin.WxMediaController;
import com.jlboot.app.admin.controller.weixin.WxMemberController;
import com.jlboot.app.admin.controller.weixin.WxMenuController;
import com.jlboot.app.admin.controller.weixin.WxMessageController;
import com.jlboot.app.admin.interceptor.AdminGlobalInterceptor;
import com.jlboot.app.admin.interceptor.ReadonlyInterceptor;
import com.jlboot.core.ConfigUtil;

import com.jfinal.config.Routes;

/**
 * Created by 51594 on 2022/7/28.
 */
public class AdminRoutes extends Routes {

    public static String ADMIN_PATH = ConfigUtil.getWebAdminPath();

    public void config() {

        //拦截器顺序不能先添加在在最外层，用于全局异常捕捉
        addInterceptor(new AdminGlobalInterceptor());
        //开启注解方式权限验证
        addInterceptor(new SaAnnotationInterceptor());
        if (ConfigUtil.READONLY()) addInterceptor(new ReadonlyInterceptor());


        setBaseViewPath("/WEB-INF/resource/pages/admin");

        add(ADMIN_PATH + "/testindex", TestIndexController.class, "/test/testindex");
        add(ADMIN_PATH + "/testcode", TestCodeController.class, "/test/testcode");
        add(ADMIN_PATH + "/testtable", TestTableController.class, "/test/testtable");
        add(ADMIN_PATH + "/testdemo", TestDemoController.class, "/test/testdemo");
        add(ADMIN_PATH + "/testlayui", TestLayuiController.class, "/test/testlayui");

        add(ADMIN_PATH + "", IndexController.class,"/index");
        add(ADMIN_PATH + "/login", LoginController.class,"/login");

        add(ADMIN_PATH + "/sysuser", SysUserController.class, "/system/sysuser/");
        add(ADMIN_PATH + "/sysrole", SysRoleController.class, "/system/sysrole/");
        add(ADMIN_PATH + "/systype", SysTypeController.class, "/system/systype/");
        add(ADMIN_PATH + "/sysdept", SysDeptController.class, "/system/sysdept/");
        add(ADMIN_PATH + "/syspost", SysPostController.class, "/system/syspost/");
        add(ADMIN_PATH + "/sysworklog", SysWorkLogController.class, "/system/sysworklog/");
        add(ADMIN_PATH + "/sysconfig", SysConfigController.class, "/system/sysconfig/");
        add(ADMIN_PATH + "/sysnotice", SysNoticeController.class, "/system/sysnotice/");
        add(ADMIN_PATH + "/syspage", SysPageController.class, "/system/syspage/");
        add(ADMIN_PATH + "/syscode", SysCodeController.class, "/system/syscode/");
        add(ADMIN_PATH + "/sysfile", SysFileController.class, "/system/sysfile/");
        add(ADMIN_PATH + "/sysdata", SysDataController.class, "/system/sysdata/");
        add(ADMIN_PATH + "/sysmenu", SysMenuController.class, "/system/sysmenu/");
        add(ADMIN_PATH + "/sysonline", SysOnlineController.class, "/system/sysonline/");
        add(ADMIN_PATH + "/sysinfo", SysInfoController.class, "/system/sysinfo/");
        add(ADMIN_PATH + "/systask", SysTaskController.class, "/system/systask/");
        add(ADMIN_PATH + "/sysactivity", SysActivityController.class, "/system/sysactivity/");
        add(ADMIN_PATH + "/sysapp", SysAppController.class, "/system/sysapp");

        add(ADMIN_PATH + "/wxmember", WxMemberController.class, "/weixin/wxmember");
        add(ADMIN_PATH + "/wxmessage", WxMessageController.class, "/weixin/wxmessage");
        add(ADMIN_PATH + "/wxmenu", WxMenuController.class, "/weixin/wxmenu");
        add(ADMIN_PATH + "/wxmedia", WxMediaController.class, "/weixin/wxmedia");


    }
}
